using MicroMsg.Manager;
using MicroMsg.Resource.@string;
using MicroMsg.Scene;
using MicroMsg.Storage;
using MicroMsg.UI.Page;
using MicroMsg.UI.Util;
using Microsoft.Phone.Controls;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class QQMailPluginSetCtrl : PluginSettingBaseCtrl
	{
		internal Grid LayoutRoot;
		internal ClickableLayout btnViewQQMail;
		internal ClickableLayout btnWriteMail;
		internal MMToggleSwitch toggleReceivePushMail;
		internal ClickableLayout btnNotifyFolder;
		private bool _contentLoaded;
		public QQMailPluginSetCtrl()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.QQMailPluginSetCtrl_Loaded));
			base.add_Unloaded(new RoutedEventHandler(this.DoFinish));
		}
		public override void Exit()
		{
			base.Exit();
		}
		public void QQMailPluginSetCtrl_Loaded(object sender, RoutedEventArgs e)
		{
			this.InitUI();
		}
		public void DoFinish(object sender, RoutedEventArgs e)
		{
		}
		private void InitUI()
		{
			Account curAccount = AccountMgr.getCurAccount();
			if (curAccount != null)
			{
				this.toggleReceivePushMail.IsChecked = (curAccount.nPushMailStatus == 1);
			}
			OnToggleStateChanged onToggleStateChanged = new OnToggleStateChanged(this.checkedStateChanged);
			this.toggleReceivePushMail.onToggleStateChanged = onToggleStateChanged;
			this.toggleReceivePushMail.Text = strings.Plugin_qqmail_switch;
		}
		private void checkedStateChanged(object sender, bool isCheckOn)
		{
			if (sender == this.toggleReceivePushMail && PushMailServiceSenter.sceneSwitchPushmail != null)
			{
				PushMailServiceSenter.sceneSwitchPushmail.doScene("", isCheckOn);
			}
			if (!isCheckOn)
			{
				this.btnNotifyFolder.set_Visibility(1);
				return;
			}
			this.btnNotifyFolder.set_Visibility(0);
		}
		private void checkedOn(object sender, EventArgs e)
		{
			this.checkedStateChanged(sender, true);
		}
		private void checkedOff(object sender, EventArgs e)
		{
			this.checkedStateChanged(sender, false);
		}
		private void btnViewMessages_Click(object sender, RoutedEventArgs e)
		{
			ToolFunction.GotoPageForUserControl("/Source/Plugin/QQMail/UI/QQMailSessionView.xaml", null, false);
			for (int i = 0; i < PageManager.getInstance().basePageList.get_Count(); i++)
			{
				if (PageManager.getInstance().basePageList.get_Item(i) is NewsSessionView)
				{
					PageManager.getInstance().PopPage();
					return;
				}
			}
		}
		private void UninstallBtn_Click(object sender, RoutedEventArgs e)
		{
		}
		private void btnWriteMail_Click(object sender, RoutedEventArgs e)
		{
			PhoneApplicationFrame phoneApplicationFrame = Application.get_Current().get_RootVisual() as PhoneApplicationFrame;
			BasePage basePage = phoneApplicationFrame.get_Content() as BasePage;
			BasePage arg_2B_0 = basePage;
			string arg_2B_1 = "/Source/Plugin/QQMail/UI/QQMailNewMailView.xaml";
			object[] object_ = new object[1];
			arg_2B_0.GoToPage(arg_2B_1, object_, false);
		}
		private void btnNotifyFolder_Click(object sender, RoutedEventArgs e)
		{
			PhoneApplicationFrame phoneApplicationFrame = Application.get_Current().get_RootVisual() as PhoneApplicationFrame;
			BasePage basePage = phoneApplicationFrame.get_Content() as BasePage;
			BasePage arg_2B_0 = basePage;
			string arg_2B_1 = "/Source/Plugin/QQMail/UI/QQMailFolderView.xaml";
			object[] object_ = new object[1];
			arg_2B_0.GoToPage(arg_2B_1, object_, false);
		}
		private void OnClearNewsMsgHandler(DlgReturnEventArg dlgReturnEventArg_0)
		{
			switch (MMMessageBox.GetUserClickResult(dlgReturnEventArg_0))
			{
			case 0:
				NewsMgr.NewsMsgClearAll();
				break;
			case 1:
				break;
			default:
				return;
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/QQMail/UI/QQMailPluginSetCtrl.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.btnViewQQMail = (ClickableLayout)base.FindName("btnViewQQMail");
			this.btnWriteMail = (ClickableLayout)base.FindName("btnWriteMail");
			this.toggleReceivePushMail = (MMToggleSwitch)base.FindName("toggleReceivePushMail");
			this.btnNotifyFolder = (ClickableLayout)base.FindName("btnNotifyFolder");
		}
	}
}
